<?php

class Child extends BaseChild
{
	
	public function __toString() {
		return $this->name;
	}

	
public function getAge()
  {


  	if (is_null($this->getBirthday())) return '';

  	$t1 = strtotime ("now");
  	$t2 = strtotime($this->getBirthday());
  	$r = $t1 - $t2;
  	$r = ((($r/60)/60)/24)/360;

  	$_res=floor($r).' '.$this->getAgeToStr(floor($r));

     return $_res;
  }

public function getAgeToStr($Age)
   {
   if(($Age>=5) && ($Age<=14)) $str = __('лет');
   else {
   $num = $Age - (floor($Age/10)*10);

   if($num == 1) { $str = __('год'); }
   elseif($num == 0) { $str = __('лет'); }
   elseif(($num>=2) && ($num<=4)) { $str = __('года'); }
   elseif(($num>=5) && ($num<=9)) { $str = __('лет'); }
   }
   return $str ;
   }
	
}
